package com.ssmTest.service.impl;

import com.ssmTest.dao.IServiceDao;
import com.ssmTest.model.Services;
import com.ssmTest.service.IServiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;

@Service("serviceService")
public class ServiceServiceImpl implements IServiceService {
    @Autowired
    IServiceService iServiceService;
    @Resource
    IServiceDao iServiceDao;

    //服务列表
    public List<Services> ServiceList(int toexamine) {
        return this.iServiceDao.ServiceList(toexamine);
    }

    public void insertService(Services service) {
        this.iServiceDao.insertService(service);
    }

    public void updateService(Services service) {
        this.iServiceDao.updateService(service);
    }

    public Services selectService(int id) {
        return this.iServiceDao.selectService(id);
    }

    public void delService(int id) {
        this.iServiceDao.delService(id);
    }

    public int updateServiceALL(Services services) {
        if (iServiceService.selectService(services.getId()) == null)
            return 0; //不存在
        iServiceDao.updateServiceAll(services);
        return 1;
    }
    public List<Services> selectByPersionalId(int personal_id){
        return this.iServiceDao.selectByPersionalId(personal_id);
    }
}
